package com.idss.authority.mvc.repository;

import cloud.agileframework.mybatis.page.MybatisPage;
import cloud.agileframework.mybatis.page.Page;
import com.idss.authority.mvc.pojo.db.SysApiEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @author 佟盟
 * 日期 2020/8/7 16:51
 * 描述 TODO
 * @version 1.0
 * @since 1.0
 */
@Mapper
public interface MyRepository {

    @Select("<script> select * from sys_api </script>")
    List<SysApiEntity> queryAll();

    @Select("<script> select * from sys_api </script>")
    Page<SysApiEntity> page(MybatisPage pageInfo);

    @Select("<script> select * from sys_api where sys_api_id = #{param}</script>")
    Page<SysApiEntity> page2(MybatisPage pageInfo);

    @Select("<script> select * from sys_api where sys_api_id = #{param}</script>")
    SysApiEntity findOne(@Param("param") String id);

    @Select("<script> select '{\"nickname\": \"goodspeed\", \"avatar\": \"avatar_url\", \"tags\": [\"python\", \"golang\", \"db\"]}'::jsonb->>'nickname' as nickname</script>")
    List<Map<String,Object>> findOne2();

    SysApiEntity findOne3(@Param("param") String id);
}
